package com.cskaoyan.gateway.controller.shopping;

import com.mall.commons.result.ResponseData;
import com.mall.commons.result.ResponseUtil;
import com.mall.shopping.MyProductService;
import com.mall.shopping.dto.ProductDetailDto;
import com.mall.user.annotation.Anoymous;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("shopping")
public class ShoppingProductController {

    @Reference(timeout = 2000, check = false)
    MyProductService myProductService;

    @Anoymous
    @RequestMapping("product/{id}")
    public ResponseData getShoppingProductByProductId(@PathVariable Integer id){


        ProductDetailDto productDetail = myProductService.getProductDetails(id);

        return new ResponseUtil<>().setData(productDetail);
    }
}
